<%@page import="com.yh.entity.Zhanfeng"%>
<%@page import="java.util.function.Supplier"%>
<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.List"%>
<%@ page language="java" pageEncoding="UTF-8"%><!DOCTYPE html>
<html>
  <head>
    <title></title>
	<jsp:include page="/admin/head.jsp"/>
  </head>
  <body>
	<jsp:include page="/admin/header.jsp"/>
	<jsp:include page="/admin/left-menu.jsp"><jsp:param value="1" name="index"/></jsp:include>
	<jsp:include page="/admin/footer.jsp"/>



    <!--中间-->
    <section>
      <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
          <li class="breadcrumb-item">管理首页</li>
          <li class="breadcrumb-item">系统中心</li>
          <li class="breadcrumb-item">用户管理</li>
          <li class="breadcrumb-item active">添加用户</li>
        </ol>
      </nav>
		<%Zhanfeng user = (Zhanfeng)request.getAttribute("user"); %>
		      <div class="card container-md">
        <div class="card-body">
          <form name="updateForm" action="admin/user-update.let" method="POST">
          	<input type="hidden" name="userId" value="<%=user.getZfId()%>"/>
            <div class="form-group row">
              <label class="col-sm-3 col-form-label text-right"><b class="text-danger">*</b>用户名</label>
              <div class="col-sm-9">
                <input required="required" readonly="readonly" pattern="^[a-zA-Z]\w{2,19}$" name="userName" type="text" placeholder="由3到20个单词字符组成"
                  title="由3到20个单词字符组成" class="form-control" value="<%=user.getZfName()%>">
              </div>
            </div>

            <div class="form-group row">
              <label class="col-sm-3 col-form-label text-right"><b class="text-danger">*</b>性别</label>
              <div class="col-sm-9 pt-2">
              	<label class="mr-2"><input type="radio" name="userSex" value="男"<%=user.getZfSex().equals("男")?"checked= \"checked\"":"" %>>男</label> 
               	<label class="mr-2"> <input type="radio" name="userSex" value="女"<%=user.getZfSex().equals("女")?"checked= \"checked\"":"" %>>女</label>
              </div>
            </div>
            
            <div class="form-group row">
              <label class="col-sm-3 col-form-label text-right">年龄</label>
              <div class="col-sm-9">
                <input name="userAge" type="tel" placeholder="有两位数字组成" class="form-control" value="<%=user.getZfAge()%>">
              </div>
            </div>
            
            <div class="form-group row">
              <label class="col-sm-3 col-form-label text-right">注册日期</label>
              <div class="col-sm-9">
               <input type="date" name="userTime"  class="form-control-plaintext" value="<%=format(user.getZfTime()) %>" style="width:auto;"/>
              </div>
            </div>

              <!-- 
              <input name="name1" value="1"/>
              <input name="name1" value="2"/>
              <input name="name1" value="3"/>
              <input name="name1" value="4"/> -->
            </div>


            <div class="form-group row">
              <div class="col-sm-9 offset-sm-3">
                <button class="btn btn-primary" type="button" onclick="history.go(-1)"> 返回 </button>
                <button class="btn btn-danger" type="submit"><i class="fa fa-edit mr-2"></i>修改 </button>
              </div>
            </div>

          </form>
        </div>
      </div>
    </section>
    
  </body>
</html>
<%!
	//private  SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
private ThreadLocal<SimpleDateFormat> format = ThreadLocal.withInitial(new Supplier<SimpleDateFormat>(){
	public SimpleDateFormat get(){
		return new SimpleDateFormat("yyyy-MM-dd");
	}
});

private String format(Date date){
	if(date==null){
		return "-";
	} else {
		return format.get().format(date);
	}
}

private ThreadLocal<SimpleDateFormat> format1 = ThreadLocal.withInitial(new Supplier<SimpleDateFormat>(){
	public SimpleDateFormat get(){
		return new SimpleDateFormat("yyyy-MM-dd HH:mm");
	}
});

private String format1(Date date){
	if(date==null){
		return "-";
	} else {
		return format1.get().format(date);
	}
}

%>
